from PIL import Image

def cutJPG(imgName,cutLen):
    img = Image.open(imgName)
    print(img.size)
    if img.size[0]>cutLen and img.size[1]>cutLen:
        cropped = img.crop((0, 0, img.size[0] - cutLen, img.size[1] - cutLen))  # (left, upper, right, lower)
        cropped.save(imgName)

if __name__ == '__main__':

    cutJPG('123.jpg',30)  #图片名